package com.module.app.adapter.holder;

import android.view.ViewGroup;
import android.widget.TextView;

import androidx.databinding.ViewDataBinding;

import com.module.app.bean.MenuMoreBean;
import com.module.base.base.adapter.BaseViewHolder;
import com.module.base.utils.DisplayUtils;
import com.module.app.R;

/**
 * @author bsnl_yanxuwen
 * @date 2020/11/4 18:56
 * Description :
 * 更多按钮
 */
public class MenuMoreHolder extends BaseViewHolder<MenuMoreBean, ViewDataBinding> {

    TextView tv_name;

    public MenuMoreHolder(ViewGroup parent) {
        super(parent, R.layout.app_item_menu_more);
    }

    @Override
    public void initView() {
        super.initView();
        tv_name = itemView.findViewById(R.id.tv_name);
    }

    @Override
    protected void convert(MenuMoreBean bean, int position) {
        if (position == 0 && position == getAdapter().getLastPosition()){
            itemView.setPadding(DisplayUtils.dip2px(25),DisplayUtils.dip2px(25),DisplayUtils.dip2px(25),DisplayUtils.dip2px(25));
        } else if (position == 0){
            itemView.setPadding(DisplayUtils.dip2px(25),DisplayUtils.dip2px(25),DisplayUtils.dip2px(25),DisplayUtils.dip2px(15));
        } else if (position == getAdapter().getLastPosition()){
            itemView.setPadding(DisplayUtils.dip2px(25),DisplayUtils.dip2px(15),DisplayUtils.dip2px(25),DisplayUtils.dip2px(25));
        } else {
            itemView.setPadding(DisplayUtils.dip2px(25),DisplayUtils.dip2px(15),DisplayUtils.dip2px(25),DisplayUtils.dip2px(15));
        }
        tv_name.setText(bean.getName());
    }
}
